package com.hzz.dao.user;

import com.hzz.framework.dao.IBaseDao;
import com.hzz.framework.entity.IEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>权限_角色vs组织 数据库处理接口类。
 */
@Mapper
public interface IAuthRoleVsOrgDao extends IBaseDao {

    /**
     * 判断是否存在
     */
    @Override
    @Select("select IFNULL(count(0),0) as count from auth_role_vs_org where  role_id = #{roleId} and  org_id = #{orgId} ")
    int isDataExist(IEntity entity) throws Exception;

    /**
     * 根据主键 物理删除
     */
    @Override
    @Delete("delete from auth_role_vs_org where  role_id = #{roleId} and  org_id = #{orgId} ")
    int deleteByPrimaryKey(IEntity entity) throws Exception;

    /**
     * 根据主键role_id 物理删除
     */
    @Delete("delete from auth_role_vs_org where  role_id = #{roleId}")
    int deleteBulkDataByRoleId(IEntity entity) throws Exception;

    /**
     * 根据主键org_id 物理删除
     */
    @Delete("delete from auth_role_vs_org where  org_id = #{orgId}")
    int deleteBulkDataByOrgId(IEntity entity) throws Exception;

    /** 根据角色获取列表 */
    List<?> findOrgIsList(IEntity entity) throws Exception;
}